package com.ht.base.system.biz.client.impl;

import com.ht.base.system.biz.manager.SelectMenuManager;
import com.ht.base.system.client.SelectMenuClient;
import com.ht.base.system.common.pojo.bo.SysMenuBO;
import com.ht.base.system.common.pojo.qto.SysMenuQTO;
import com.ht.base.system.common.pojo.vo.RouterVo;
import com.ht.base.system.common.pojo.vo.TreeSelect;
import org.base.common.appexception.AppException;
import org.base.common.appexception.ResultData;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author hdengxian
 * @Date 2023/8/15 17:01
 */
@DubboService
@Component
public class SelectMenuClientImpl implements SelectMenuClient {
    @Resource
    private SelectMenuManager selectMenuManager;

    @Override
    public ResultData<SysMenuBO> selectMenuById(Long sysMenuId) throws AppException {
        return new ResultData<>(selectMenuManager.selectMenuById(sysMenuId));
    }

    @Override
    public ResultData<List<SysMenuBO>> selectMenuList(SysMenuQTO qto) throws AppException {
        return new ResultData<>(selectMenuManager.selectMenuList(qto));
    }

    @Override
    public ResultData<List<SysMenuBO>> selectMenuListByRoleId(Long sysRoleId) throws AppException {
        return new ResultData<>(selectMenuManager.selectMenuListByRoleId(sysRoleId));
    }

    @Override
    public ResultData<List<SysMenuBO>> selectMenuListByUserId(Long sysUserId) throws AppException {
        return new ResultData<>(selectMenuManager.selectMenuListByUserId(sysUserId));
    }

    @Override
    public ResultData<List<SysMenuBO>> buildMenuTree(List<SysMenuBO> menus) throws AppException {
        return new ResultData<>(selectMenuManager.buildMenuTree(menus));
    }

    @Override
    public ResultData<List<TreeSelect>> buildTreeSelect(List<SysMenuBO> menus) throws AppException {
        return new ResultData<>(selectMenuManager.buildTreeSelect(menus));
    }

    @Override
    public ResultData<List<RouterVo>> getRouters(List<SysMenuBO> menuTree) throws AppException {
        return new ResultData<>(selectMenuManager.getRouters(menuTree));
    }
}
